<template>
	<div>
		<NavigationBar title-text="资讯详情" :custom-back-func="handleNavigateBack" />
		<Message ref="message" />
		<Loading ref="loading" fullscreen />

		<div class="inquiries-container w-full pt-160rpx pb-0rpx px-0rpx bg-hex-a0cfff overflow-x-hidden">
			<div class="w-full min-h-90vh flex-column bg-hex-f4f4f5 overflow-x-hidden">
               <div class="p-20rpx">
				<div class="w-full text-38rpx font-bold p-20rpx mt-10rpx title-text bg-white bor">
					{{ inquiriesinfo.title }}
				</div>
				<div class="w-full text-28rpx p-20rpx title-text bg-white mt-15rpx mb-15rpx bor">
					{{ inquiriesinfo.synopsis }}
				</div>
				<div class="w-full text-30rpx p-20rpx bg-white bor line">
					{{ inquiriesinfo.content }}
				</div>
				<div class="w-full mt-15rpx flex justify-end">{{moment(inquiriesinfo.time).format("YYYY-MM-DD")}}</div>
			   </div>
			</div>
		</div>
	</div>
</template>

<script setup lang="ts">
import moment from 'moment'; 
import Message from '@/components/message/src/message.vue';
import type { MessageMethod } from '@/components/message';
import Loading from '@/components/loading/src/loading.vue';
import type { LoadingMethod } from '@/components/loading';
import NavigationBar from '@/components/navigation-bar/src/navigation-bar.vue';
import { gotoPage } from '@/common/utils';
import { useUserStore } from '@/store';
import { systemApi } from '@/service/api';

const userStore = useUserStore();

const message = ref<InstanceType<typeof Message> & MessageMethod>(null);
const loading = ref<InstanceType<typeof Loading> & LoadingMethod>(null);
const id = ref<string>('');
const inquiriesinfo = ref({});
// 初始化
const init = async () => {
	await systemApi.getInquiriesinfo({id:id.value}).then((res)=>{
	console.log(res);
	inquiriesinfo.value=res.data?.data.result[0]
   }).catch((err)=>{
	console.log(err);
   })
};


// 返回上一页
const handleNavigateBack = (): void => {
	uni.navigateBack({
		delta: 2,
	});
};
onLoad((option) => {
	if (option) {
		id.value = option.id;
		console.log(id.value);
		init();
		return;
	}
	nextTick(() => uni.navigateBack());
});
onShow(() => {});
</script>

<style scoped lang="scss">
@import 'inquiries';
</style>
